package o;

import android.text.TextUtils;
import com.huawei.hms.framework.network.restclient.hianalytics.HianalyticsData;
import java.util.LinkedHashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;

public class eqs {
    private static final String ˋ = eqs.class.getSimpleName();
    private static final Object ˎ = new Object();
    private static eqs ˏ;
    private long ʼ;
    private ConcurrentHashMap<String, String> ʽ = new ConcurrentHashMap();
    private final AtomicInteger ˊ = new AtomicInteger();
    private final AtomicInteger ॱ = new AtomicInteger();
    private volatile boolean ॱॱ = false;

    public static eqs ˎ() {
        eqs o_eqs;
        synchronized (ˎ) {
            if (ˏ == null) {
                ˏ = new eqs();
            }
            o_eqs = ˏ;
        }
        return o_eqs;
    }

    public synchronized void ˊ(boolean z) {
        Logger.ˏ(ˋ, "First tab loaded. firstTabHasLoaded=" + z);
        this.ॱॱ = z;
    }

    public synchronized void ˎ(String str) {
        if (!(!this.ॱॱ || this.ˊ.get() == 5 || TextUtils.isEmpty(str))) {
            int incrementAndGet = this.ˊ.incrementAndGet();
            if (incrementAndGet == 1) {
                this.ʼ = System.currentTimeMillis();
                if (Logger.ˎ()) {
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.append("First image start to load.").append("currentIndex=").append(incrementAndGet).append("imageLoadTime=").append(this.ʼ);
                    Logger.ˏ(ˋ, stringBuilder.toString());
                }
            }
            if (incrementAndGet <= 5) {
                this.ʽ.put(str, str);
                Logger.ˏ(ˋ, "start load url = " + str);
            }
        }
    }

    public synchronized void ˊ(String str) {
        if (!(!this.ॱॱ || this.ॱ.get() == 5 || TextUtils.isEmpty(str))) {
            if (!TextUtils.isEmpty((String) this.ʽ.get(str))) {
                Logger.ˏ(ˋ, "onLoaded url = " + str);
                if (this.ॱ.incrementAndGet() == 5) {
                    this.ʼ = System.currentTimeMillis() - this.ʼ;
                    String concat = cdj.ˏ().concat("026");
                    LinkedHashMap linkedHashMap = new LinkedHashMap();
                    linkedHashMap.put(HianalyticsData.ERROR_CODE, "time_0003_".concat(this.ʼ + ""));
                    ese.ˋ(concat, linkedHashMap);
                }
            }
        }
    }

    public synchronized void ॱ() {
        this.ॱॱ = false;
        this.ˊ.set(0);
        this.ॱ.set(0);
    }
}
